package com.company.shop;

import com.company.creature.Creature;
import com.company.creature.Person;

/**
 * @description:
 * @author: ZhaoYicong
 * @date: Created in 2020/5/15 21:22
 * @version: v1.0
 * @modified By:
 */
public  class ArmorShop extends Armor {
    public ArmorShop(int smoney, String id, String name, int defenseValue) {
        super(smoney, id, name, defenseValue);
    }

    @Override
    public String getSay() {
        return"生命上限增加"+this.getDefenseValue()+"，并恢复同等的血量值。";
    }



    @Override
    public void function(Creature creature) {
        if (creature.getArmor().getId().equals(getId())){
            System.out.println("抱歉你已经买了无法购买");

        }else{
            creature.setMoney(creature.getMoney()+creature.getArmor().getSmoney()/2-this.getSmoney());
            creature.setArmor(this);
            creature.setHplimit(creature.getHplimit()+this.getDefenseValue());
            creature.setHp(creature.getHp()+this.getDefenseValue());
        }


    }
}
